import { Routes } from '../index'
import userRoutersStore from '../../store/userouter'

// 获取用户对应路由
export async function routes() {
    try {
        const response = await Routes.routes();
        const info = response.data.data;

        if (!info) {
            ElMessage.error("没有数据");
        } else {
            const data = {
                path: info.path,
                name: info.name,
                component: info.component,
                meta: info.meta
            };
            userRoutersStore().RoutesTable(data);
        }
    } catch (error) {
        console.log(error);
    }
}